"""
datetime :
    time        时间
    date        日期
    datetime    日期时间  now()
    timedelta  时间差   timedelta(days=‘’，weeks='',....)
"""
import datetime
import time

print(datetime.time.hour)  # 对象

print(str(time.localtime().tm_hour))
print(datetime.date)

print(datetime.date.day)

print(datetime.date.ctime(datetime.date(2022, 10, 19)))

# datetime、timedelta

print(datetime.date.today())  # 2022-11-14
# 时间差值
time_del = datetime.timedelta(hours=2)
print(time_del)  # 2:00:00
now = datetime.datetime.now()
print(now)  # 2022-11-14 14:41:11.060318

print(now + time_del)  # 2022-11-14 12:42:31.600938

# 缓存：数据库做缓存、MySQL redis、会话机制：Session
week_del = datetime.timedelta(weeks=3)  # 3周
dy_del = datetime.timedelta(days=3, hours=7)  # 3周
print(now + week_del)  # 2022-12-05 14:46:16.897655
